package com.walle.ak47.commons.utils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;

import org.apache.log4j.Logger;


public class PropertiesReader {
	private static Logger log = Logger.getLogger(PropertiesReader.class);
	
	public static String getWebConfig(String key){
		String str = "";
		try {
			Properties p = new Properties();
			InputStream inputStream = PropertiesReader.class.getResourceAsStream("/config.properties"); 
			BufferedReader bf = new BufferedReader(new InputStreamReader(inputStream,"UTF-8"));
			p.load(bf);
			
			str=p.getProperty(key);
		} catch (IOException e) {
			log.error(e.getMessage(),e);
		}
		
		return str;
	}
	
	public static void main(String[] args)throws Exception {
		String r = getWebConfig("NET.RSA.PRIVATEKEY.XML");
		System.out.println(r);
	}
}
